﻿
<?php



    if(!empty($_POST)){

       // $xf = add('power',$_POST);
        // print_r($xf);
      $rule= $_POST['rule'];

      $pid=$_POST['pid'];

      $name=$_POST['name'];


    $sql = "INSERT INTO `power`(`rule`,`pid`,`name`) VALUES ('$rule','$pid','$name')";

           mysqli_query($link,'set names utf8');

          mysqli_query($link,$sql);

       $_rows=mysqli_affected_rows($link);
      //调用添加函数
               //判断$xf的值是否大于0，大于则编辑成功
           if($_rows>0){

               echo '<script>alert("权限添加成功");location.href="index.php?c=power&a=list&admin=1"; </script>';

            }else{

        echo '<script>alert("权限添加失败");history.go(-1) </script>';
      }
}







 //载入后台公共视图
    include_once (VIEW_PATH.'admin/layout.html');
?>